/**
 * 
 */
package edu.cmu.mism.dgjava.data.ui.tree;

import org.eclipse.draw2d.AbstractBorder;
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.ToolbarLayout;
import org.eclipse.draw2d.geometry.Insets;

/**
 * Compartment Figure to hold the label section within a tree node
 * 
 * @author Christian
 * 
 */
public class TreeLabelSectionFigure extends Figure {

	public TreeLabelSectionFigure() {
		ToolbarLayout layout = new ToolbarLayout();
		layout.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
		layout.setStretchMinorAxis(false);
		layout.setSpacing(5);
		setLayoutManager(layout);
		setBorder(new SectionFigureBorder());
	}

	private class SectionFigureBorder extends AbstractBorder {

		public Insets getInsets(IFigure figure) {
			// draw the border in 1 px
			return new Insets(1, 0, 0, 0);
		}

		public void paint(IFigure figure, Graphics graphics, Insets insets) {
			graphics.drawLine(getPaintRectangle(figure, insets).getTopLeft(),
					tempRect.getTopRight());
		}
	}
}
